import json
from random import randint

from wechat import wechat
from auth import auth_encode

TEMPLATE_ID = 'sPjmeemF4XwrUfX68gDQiCJTE8XVBpV1kM5jSN9fu9I'


def get_followers(wechat):
    response = wechat.get_followers()
    return response['data']['openid']


def send_msg():
    openid = 'oJ6-vwWMDVB-pB7kSYHLuZmppv8A'
    template_id = '3m2htcd2GfHgwCP8xYZueMnEVSqNutvPeQzb99bDJrw'
    data = {
        'first': {'value': '您有新的订单:'},
        'keyword1': {'value': 'xsc'},  # shop
        'keyword2': {'value': 'finley'},  # user
        'keyword3': {'value': '12'},  # type
        'keyword4': {'value': '1000'},  # amount
        'keyword5': {'value': 'now'},  # time
    }
    url = 'http://119.29.172.38/auth'
    wechat.send_template_message(openid, template_id, data, url)
